package com.zxy.config;

import com.alibaba.cloud.nacos.ribbon.NacosRule;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.netflix.loadbalancer.RoundRobinRule;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@RibbonClients(defaultConfiguration = RandomRule.class) ////全局定义负载策略
//@RibbonClient(name = "nacos-a", configuration = MyRule.class)
public class RabbinConfig {

   // @Bean //全局定义负载策略
    public IRule rule(){
         // return  new NacosRule();
        return  new RoundRobinRule();
        //  return  new MyRule();
    }
}
